/**
 * @file rank/elementary/luogu1534/main.cpp
 * @brief
 * @see
 * @author Ruiming Guo (guoruiming@stu.scu.edu.cn)
 * @copyright 2022
 * @date 2022/7/7 14:37:01
 **/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main() {
  // High rating and good luck!
  int n;
  cin >> n;
  int sum = 0;
  int ans = 0;
  while (n--) {
    int a, b;
    cin >> a >> b;
    sum += a + b - 8;
    ans += sum;
  }
  cout << ans << endl;
  return 0;
}
